package javolution.xml.stream;

import java.io.InputStream;
import java.io.Reader;
import java.util.Map;
import javolution.context.ObjectFactory;
import javolution.lang.Configurable;

/* loaded from: classes2.dex */
public abstract class XMLInputFactory {
    public static final String ENTITIES = "javolution.xml.stream.entities";
    public static final String IS_COALESCING = "javolution.xml.stream.isCoalescing";
    public static final Configurable<Class<? extends XMLInputFactory>> DEFAULT = new Configurable<>(Default.CLASS);
    private static ObjectFactory XML_READER_FACTORY = new ObjectFactory() { // from class: javolution.xml.stream.XMLInputFactory.1
        /* JADX INFO: Access modifiers changed from: protected */
        @Override // javolution.context.ObjectFactory
        public void cleanup(Object obj) {
            ((XMLStreamReaderImpl) obj).reset();
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // javolution.context.ObjectFactory
        public Object create() {
            return new XMLStreamReaderImpl();
        }
    };

    /* loaded from: classes2.dex */
    private static final class Default extends XMLInputFactory {
        static final Class CLASS = new Default().getClass();
        Map _entities;

        private Default() {
            this._entities = null;
        }

        private XMLStreamReaderImpl newReader() {
            XMLStreamReaderImpl xMLStreamReaderImpl = (XMLStreamReaderImpl) XMLInputFactory.XML_READER_FACTORY.object();
            Map map = this._entities;
            if (map != null) {
                xMLStreamReaderImpl.setEntities(map);
            }
            xMLStreamReaderImpl._objectFactory = XMLInputFactory.XML_READER_FACTORY;
            return xMLStreamReaderImpl;
        }

        @Override // javolution.xml.stream.XMLInputFactory
        public XMLStreamReader createXMLStreamReader(InputStream inputStream) throws XMLStreamException {
            XMLStreamReaderImpl newReader = newReader();
            newReader.setInput(inputStream);
            return newReader;
        }

        @Override // javolution.xml.stream.XMLInputFactory
        public XMLStreamReader createXMLStreamReader(InputStream inputStream, String str) throws XMLStreamException {
            XMLStreamReaderImpl newReader = newReader();
            newReader.setInput(inputStream, str);
            return newReader;
        }

        @Override // javolution.xml.stream.XMLInputFactory
        public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
            XMLStreamReaderImpl newReader = newReader();
            newReader.setInput(reader);
            return newReader;
        }

        @Override // javolution.xml.stream.XMLInputFactory
        public Object getProperty(String str) throws IllegalArgumentException {
            if (str.equals(XMLInputFactory.IS_COALESCING)) {
                return new Boolean(true);
            }
            if (str.equals(XMLInputFactory.ENTITIES)) {
                return this._entities;
            }
            throw new IllegalArgumentException("Property: " + str + " not supported");
        }

        @Override // javolution.xml.stream.XMLInputFactory
        public boolean isPropertySupported(String str) {
            return str.equals(XMLInputFactory.IS_COALESCING) || str.equals(XMLInputFactory.ENTITIES);
        }

        @Override // javolution.xml.stream.XMLInputFactory
        public void setProperty(String str, Object obj) throws IllegalArgumentException {
            if (str.equals(XMLInputFactory.IS_COALESCING)) {
                return;
            }
            if (str.equals(XMLInputFactory.ENTITIES)) {
                this._entities = (Map) obj;
                return;
            }
            throw new IllegalArgumentException("Property: " + str + " not supported");
        }
    }

    static {
        ObjectFactory.setInstance(new ObjectFactory() { // from class: javolution.xml.stream.XMLInputFactory.2
            /* JADX INFO: Access modifiers changed from: protected */
            @Override // javolution.context.ObjectFactory
            public Object create() {
                return new Default();
            }
        }, Default.CLASS);
    }

    protected XMLInputFactory() {
    }

    public static XMLInputFactory newInstance() {
        return (XMLInputFactory) ObjectFactory.getInstance(DEFAULT.get()).object();
    }

    public abstract XMLStreamReader createXMLStreamReader(InputStream inputStream) throws XMLStreamException;

    public abstract XMLStreamReader createXMLStreamReader(InputStream inputStream, String str) throws XMLStreamException;

    public abstract XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException;

    public abstract Object getProperty(String str) throws IllegalArgumentException;

    public abstract boolean isPropertySupported(String str);

    public abstract void setProperty(String str, Object obj) throws IllegalArgumentException;
}
